package Cn.Sarkar.MMS.Entities.Additional

import Cn.Sarkar.Entities.Common.Additional.IName
import Cn.Sarkar.Entities.Common.BaseEntity
import Cn.Sarkar.Entities.MMS.Additional.ICountry
import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.Core.Extensions.hasMany
import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.Core.Extensions.hasOne
import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.Core.Extensions.hasOneNullable
import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.IDataContext
import Cn.Sarkar.MMS.DataBaseDefinations.Additional.Countries

class Country(DataContext: IDataContext) : BaseEntity(DataContext, Countries), ICountry {
    var nameID by Countries.NameID
    override var name: IName by hasOne(Countries.NameID) { Name(it) }
    var parentID by Countries.ParentID
    override var parent: ICountry? by hasOneNullable(Countries.ParentID) { Country(it) }
    val childs by hasMany(Countries.ParentID) { Country(it) }
    override var latitude: String by Countries.Latitude
    override var longitude: String by Countries.Longitude
    override var layer by Countries.Layer
}